<?php

class Form_Artist extends Zend_Form
{

    public function init()
    {
        $id = new Zend_Form_Element_Hidden("id");
        $id->setValue(0);
        $id->setRequired(true);
        $idValidator = new Zend_Validate_Int();
        $id->addValidator($idValidator);
        $this->addElement($id, "id");
        
        
        $name = new Zend_Form_Element_Text("name");
        $name->setLabel("Name: ");
        $name->setRequired(true);
        $nameValidator = new Zend_Validate_Alpha(true);
        $name->addValidator($nameValidator);
        $this->addElement($name, "name");
        
        
        $gender = new Zend_Form_Element_Radio("gender");
        $gender->setLabel("Gender: ");
        $gender->setRequired(true);
        $gender->addMultiOption("M","男")
        		->addMultiOption("F","女")
        		->setValue("M")
        		->setSeparator(" ");
        		
        		
        $this->addElement($gender, "gender");
        
        
        $birth = new Zend_Form_Element_Select("birth");
        $birth->setLabel("Birth: ");
        $birth->addMultiOptions(array(
        	"1930`s" => "1930`s",
        	"1940`s" => "1940`s",
	        "1950`s" => "1950`s",
	        "1960`s" => "1960`s",
	        "1970`s" => "1970`s",
	        "1980`s" => "1980`s",
	        "1990`s" => "1990`s"
        ));
        $this->addElement($birth, "birth");
        
        
        $education_background = new Zend_Form_Element_Textarea("education_background");
        $education_background->setLabel("Education Background: ");
        $education_background->setAttrib("class", "ckeditor");
        $this->addElement($education_background, "education_background");
        
        
        $degree = new Zend_Form_Element_Text("degree");
        $degree->setLabel("Degree: ");
        $this->addElement($degree, "degree");
        
        
        $solo_exh = new Zend_Form_Element_Textarea("solo_exh");
        $solo_exh->setLabel("Solo Exhibition: ");
        $solo_exh->setAttrib("class", "ckeditor");
        $this->addElement($solo_exh, "solo_exh");
        
        
        $group_exh = new Zend_Form_Element_Textarea("group_exh");
        $group_exh->setLabel("Group Exhibition: ");
        $group_exh->setAttrib("class", "ckeditor");
        $this->addElement($group_exh, "group_exh");
        
        
        $resume = new Zend_Form_Element_Textarea("resume");
        $resume->setLabel("Self Introduction: ");
        $resume->setAttrib("class", "ckeditor");
        $this->addElement($resume, "resume");
        
        $famous = new Zend_Form_Element_Radio("famous");
        $famous->setLabel("名家: ");
        $famous->setRequired(true);
        $famous->addMultiOption("1","是")
        		->addMultiOption("0","否")
        		->setValue(0)
        		->setSeparator(" ");
        		
        		
        $this->addElement($famous, "famous");
        
        
        $display_positions = new Zend_Form_Element_Select("display_position");
        $display_positions->setLabel("Display Positions: ");
        $display_positions->addMultiOption(0, "默认（普通艺术家列表页）");
        $display_positions->addMultiOption(1, "首页右侧Artist apprisal");
        $display_positions->addMultiOption(2, "首页右侧Artist interview");
        $display_positions->addMultiOption(3, "首页批评家说");
        $displayPositionValidator = new Zend_Validate_Int();
        $display_positions->addValidator($displayPositionValidator);
        $this->addElement($display_positions, "display_position");
        
        
        $photo = new Zend_Form_Element_File("photo");
        $photo->setLabel("Photo: ")->setRequired(true)
        	->setDestination(APPLICATION_PATH . "/../public/images/artists_avar/");
        	
        $photoFilter = new Zend_Filter_File_Rename(md5(microtime()) . ".jpg");
        
        $photo->addFilter($photoFilter);
        	
        $photoValidator = new Zend_Validate_File_Extension("jpg");
        $photo->addValidator($photoValidator);
        $this->addElement($photo, "photo");
        
        $submit = new Zend_Form_Element_Submit("submit");
        $this->addElement($submit, "submit");
    }


}

